export const menuKey = [["children","subMenu"],["key","id"]];
export const organizerTreeKey = [["title","groupName"]]
// 生成额外参数
export const initChildren = function(list,listCreateKey=[["children","subMenu"]]) {
 list.forEach(element => {
     listCreateKey.forEach(vv=>{
   element[vv[0]] = element[vv[1]];
     })
   if (element.children && element.children.length) {
     initChildren(element.children,listCreateKey);
   }
 });
 return list
}

export const menuDelKey = [['status',"ENABLE"]]
// 剔除 value != only value 发现不同则删除
export function initDel(list,listDelKey){
 list.forEach((element,index)=>{
   let bl =Boolean(false)
   listDelKey.forEach(vv=>{
     bl = element[vv[0]] != vv[1]
     if (bl) {
       list.splice(index,1,null)
     }
   })

   if (!bl && element && element.children && element.children.length) {
     element.children = initDel(element.children,listDelKey);
   }

 })
list = list.filter(v=>v)
return list
}